
// 二次封装请求接口
const BASE_URL = 'http://139.9.151.197:8889'
// const BASE_URL = 'http://192.168.31.19:8889'
 
export const myRequest = (options) => {
	return new Promise((resolve, reject) => {
		uni.request({
			url: BASE_URL + options.url,
			method: options.method || 'GET',
			data: options.data || {},
			success: (res) => {
				// console.log('传入的数据',options.data)
				console.log("调用接口成功",res)
				if(res.data.code !== 200){
					return uni.showToast({
						title: "错误code="+res.data.code,
						icon:'none'
					})
				}
				resolve(res)
			},
			fail: (err) => {
				uni.showToast({
					title: '请求接口失败',
					icon:'none'
				})
				reject(err)
			}
		})
	})
}